<template>
<div>登录中............</div>
</template>

<script>
export default {
  name: "CallbackView",
  data() {
    return {
      userInfo: ''
    }
  },
  methods:{
    getCode(){
      var code = this.$route.query.code;//?code=F7OPXM&state=normal
      this.axios.get("http://192.168.21.1/api/user/callBack?code="+code).then(resp=>{
        alert(JSON.stringify(this.userInfo))
        //将这个对象存储在localStorage中
        localStorage.setItem("username",resp.data.username)
        localStorage.setItem("token",resp.data.token)
        this.$router.push("/list")
      })

    }
  },
  created() {
    this.getCode();
  }
}
</script>

<style scoped>

</style>